package com.lanchewuyou.user.driver.layouts;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lanchewuyou.user.driver.R;

/**
 * 维修结果详情页展示itemlayout
 */
public class FixItemLayout extends LinearLayout {
    private TextView titleText;
    private ImageView isNotFix, isFix;

    public FixItemLayout(Context context) {
        super(context);
    }

    public FixItemLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.fixitem_layout, this);
        titleText = (TextView) findViewById(R.id.item_title_text);
        isNotFix = (ImageView) findViewById(R.id.notfix_img);
        isFix = (ImageView) findViewById(R.id.fix_img);
    }

    public void setTitleText(String title) {
        titleText.setText(title);
    }

    public void setIsNotFix(int isNotFixId) {
        switch (isNotFixId) {
            case 0:
                isNotFix.setImageResource(R.mipmap.fix_no);
                break;
            case 1:
                isNotFix.setImageResource(R.mipmap.fix_yes);
                break;
            default:
                break;
        }
    }

    public void setIsFix(int isFixId) {
        switch (isFixId) {
            case 0:
                isFix.setImageResource(R.mipmap.fix_no);
                break;
            case 1:
                isFix.setImageResource(R.mipmap.fix_yes);
                break;
            default:
                break;
        }
    }
}
